﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.OleDb;

public partial class add_room_detail : System.Web.UI.Page
{
    OleDbConnection conx;

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        Response.Redirect("addtype.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            String con = "Provider=MSDAORA;Data Source=orcl;Password=oracle;User ID=pearl";//"DSN=orcl;Driver={Microsoft ODBC for Oracle};UID=system;PWD=password;SERVER=localhost;";
            conx = new OleDbConnection(con);
            conx.Open();

            if (conx.State == ConnectionState.Open)
            {
                Label1.Text = "Oracle Connected";

                string tb1 = TextBox1.Text;
                string tb2 = TextBox2.Text;
                string tb3 = TextBox3.Text;
                string tb4 = TextBox4.Text;
                string tb5 = TextBox5.Text;

                TextBox1.Text = "";
                TextBox2.Text = "";
                TextBox3.Text = "";
                TextBox4.Text = "";
                TextBox5.Text = "";

                DataSet ds = new DataSet("Dataset1");
                OleDbCommand ODC = new OleDbCommand("INSERT INTO ROOM_DETAIL VALUES('" + tb1 + "','" + tb2 + "'," + Convert.ToInt32(tb3) + ",'" + tb4 + "','" + tb5 + "')", conx);
                
                ODC.ExecuteNonQuery();
                Label1.Text = "\"New Room Detail Inserted\"";

            }
            else
                Label1.Text = "Oracle Connect Failed";

        }

        catch (Exception ex)
        {
            Label1.Text = ex.Message + "<br />" + ex.StackTrace;
        }

        finally
        {
            conx.Close();
            conx = null;
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox5.Text = "";
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        Response.Redirect("view_list_room_detail.aspx");
    }
}